<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@page isELIgnored="false"%>
<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<script type="text/javascript">
	$(document).ready(function(){
		$("#flex1").flexigrid
		(
		{
		url: 'periodo.lista.ajax.htm',
		dataType: 'json',
		colModel : [
			{display: 'ID', name : 'periodo.id', width : 40, sortable : true, align: 'center'},
			{display: 'Name', name : 'periodo.descricao', width : 180, sortable : true, align: 'left'},
			{display: 'Date de Inicio', name : 'periodo.dataInicio', width : 120, sortable : true, align: 'left'},
			{display: 'Date de Fim', name : 'periodo.dataFim', width : 130, sortable : true, align: 'left', hide: false}
			],
		buttons : [
			{name: 'Add', bclass: 'add', onpress : test},
			{name: 'Delete', bclass: 'delete', onpress : test},
			{separator: true}
			],
		searchitems : [
			{display: 'ID', name : 'periodo.id'},
			{display: 'Name', name : 'periodo.descricao', isdefault: true}
			],
		sortname: "iso",
		sortorder: "asc",
		usepager: true,
		title: 'Períodos',
		useRp: true,
		rp: 15,
		showTableToggleBtn: true,
		width: 450,
		height: 200
		}
		);   
	
	});
	function test(com,grid)
	{
		if (com=='Delete')
			{
				confirm('Delete ' + $('.trSelected',grid).length + ' items?')
			}
		else if (com=='Add')
			{
				alert('Add New Item');
			}			
	}
</script>
<table id="flex1" style="display:none"></table>
